---
# Configuration for the the-new-hotness consumer
#
- name: install rebase helper from epel-testing
  package: name={{ item }} state=present enablerepo=epel-testing
  with_items:
  - rebase-helper
  tags:
  - packages
  - hotness

- name: install needed packages
  package: name={{ item }} state=present
  with_items:
  - the-new-hotness
  - python-psycopg2
  - python-sh
  - koji
  - fedpkg
  - git
  - rpmdevtools  # Note that we hotfix rpmdev-bumpspec on top of this
  tags:
  - packages
  - hotness

- name: hotfix rpmdev-bumpspec to a copy from rpmdevtools-8.5-1
  copy: src=hotfix/rpmdev-bumpspec dest=/usr/bin/rpmdev-bumpspec
  tags:
  - hotfix
  - hotness

- name: copy hotness fedmsg configuration
  template: >
    src={{ item }} dest=/etc/fedmsg.d/{{ item }}
    owner=fedmsg group=fedmsg mode=0600
  with_items:
  - hotness.py
  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"
  notify:
  - restart fedmsg-hub
  tags:
  - config
  - hotness

- name: install hotness.pem koji key and cert
  copy: >
    src="{{ private }}/files/hotness_key_and_cert.pem"
    dest="/etc/pki/fedmsg/hotness.pem"
    owner=fedmsg
    group=fedmsg
    mode=0400
  tags:
  - config
  - hotness

- name: install koji ca cert
  copy: >
    src="{{ private }}/files/fedora-ca.cert"
    dest="/etc/pki/fedmsg/{{ item }}"
    owner=root
    group=root
    mode=0644
  with_items:
  - fedora-server-ca.cert
  - fedora-upload-ca.cert
  tags:
  - config
  - hotness

- name: Copy over a yum config for repoquery
  copy: src=yumconfig dest=/etc/hotness-yum.conf
  tags:
  - config
  - hotness

- name: Copy over rpmmacros configuration
  copy: src=rpmmacros dest=/etc/rpm/macros.hotness
  tags:
  - config
  - hotness

- name: Drop old /usr/share/fedmsg (once used for bugzilla cookies...)
  file: dest=/usr/share/fedmsg state=absent
  tags:
  - hotness
